'use strict';

module.exports = app => {
    const { STRING, UUID, UUIDV4, INTEGER, DECIMAL } = app.Sequelize;

    const model = app.model.define('batch', {
        id: {
            type: UUID,
            defaultValue: UUIDV4,
            primaryKey: true,
            comment: 'Id',
        },
        customer_id: {
            type: UUID,
            comment: '客户Id',
        },
        remark: {
            type: STRING,
            comment: '备注'
        },
        sum: {
            type: DECIMAL(10, 2),
            comment: '产品合计金额'
        },
        fee: {
            type: DECIMAL(10, 2),
            comment: '维护费=产品合计*0.1'
        },
        total: {
            type: DECIMAL(10, 2),
            comment: '总计价格'
        },
        confirm: {
            type: DECIMAL(10, 2),
            comment: '总计价格基础上的优惠金额'
        },
        status: {
            type: INTEGER,
            comment: '状态 1:草稿 2:口头报价 3:正式报价',
        },
        status_text: {
            type: STRING,
            comment: '状态 已发布',
        },
    }, {
            tableName: 'batch',
            comment: '需求批次表',
        });

    return model;
};
